[13.x] Add Postgres transaction pooler support#60425
Open
DGarbs51 wants to merge 3 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
::directrouting for the database manager, migrations, schema dump/load, and maintenance commands.::read,::write,--read,--write, and--pooledrouting, and makephp artisan dbdefault to direct only when pooled mode is enabled.Benefit to end users
Many PostgreSQL providers, including Neon and PlanetScale through PgBouncer and AWS RDS Proxy, use transaction-mode pooling. Today, Laravel users must handle prepared statement behavior, boolean binding edge cases, and direct DDL routing themselves. This gives Laravel applications a framework-level path for using PostgreSQL connection proxying and pooling without custom connection wrappers.
Backward compatibility
pooled => trueor a configured direct endpoint keep the existing native-prepare behavior.php artisan dbonly defaults to direct when pooled mode is enabled and a direct endpoint exists, so adding a direct endpoint alone does not change the default interactive CLI target.true/falsestrings instead of integer literals.PGSSLMODEis only exported for schema dump/load when an sslmode value is configured.Tests
vendor/bin/pint src/Illuminate/Database/PostgresConnection.php src/Illuminate/Database/Schema/PostgresSchemaState.php tests/Database/DatabasePostgresSchemaStateTest.phpvendor/bin/phpunit tests/Databasevendor/bin/phpunit tests/Integration/Foundation/CloudTest.phpvendor/bin/phpunit tests/Integration/Database/Postgres/DatabasePgsqlPooledConnectionTest.php(skipped locally when the PostgreSQL test database is unavailable)git diff --check